// 引入接口地址
import { seckList } from "@/request/api"

// 秒杀仓库模块
const state = {
    seckList: [],
}

const mutations = {
    REQ_SECKLIST(state, payload) {
        return state.seckList = payload
    }
}

const actions = {
    getSeckList_Action({ commit }) {
        // 调用秒杀列表接口
        seckList().then(res => {
            console.log(res);
            if (res.code == 200) {
                commit("REQ_SECKLIST", res.list)
            }
        })
    }
}

const getters = {
    getSeckList(state) {
        return state.seckList
    }
}

// 导出仓库
export default {
    state,
    mutations,
    actions,
    getters,
    namespaced: true
}